package com.ruiyian.netty.nettyUdpserver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

//该类在项目启动后执行
@Component
public class NettyUdpServerConfig implements CommandLineRunner {

    private static final Logger LOG = LoggerFactory.getLogger(NettyUdpServerConfig.class);

    @Autowired
    private NettyUdpServer nettyUdpServer;

    @Override
    public void run(String... args) {
        nettyUdpServer.init(1566);
        LOG.info("netty服务器初始化成功，端口号:{}", 1566);
    }
}
